home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / U-Z / VideoToolBox Folder / VideoToolboxSources / RestoreCluts.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-22  |  1.6 KB  |  43 lines  |  [TEXT/KAHL]

  1. /*
  2. RestoreCluts.c
  3. Developing programs that modify the clut can be annoying, because one frequently
  4. aborts the program for one reason or another and then faces an editing environment
  5. in which text is hard to see because of the weird clut settings. No longer.
  6.  
  7. Somewhere near the beginning of your program insert the line:
  8.  
  9. _atexit(RestoreCluts);
  10.  
  11. This tells the THINK C runtime environment to run RestoreCluts() at exit, even if
  12. it's an abnormal exit, e.g. escape to shell from MacsBug.
  13.  
  14. CAUTION: the atexit() and _atexit() routines probably should not be used in
  15. MATLAB code resources. The reason is that they will only be invoked when MatLab
  16. exits, after your code resources have already been flushed, so you'll crash.
  17.  
  18. For reasons that I don't understand, Apple's RestoreDeviceClut doesn't seem to 
  19. do anything, even though my GDRestoreDeviceClut works fine.
  20.  
  21. HISTORY:
  22. 4/25/92 dgp    wrote it. Why didn't I think of this sooner?
  23. 12/8/92 dgp simplified code, based on Apple's Snippet: 
  24.             RestoreColorsSlam() in ColorReset.c.
  25. 12/9/92    dgp    replaced call to Apple's RestoreDeviceClut by my GDRestoreDeviceClut, 
  26.             since Apple's routine doesn't seem to do anything.
  27. 12/15/92 dgp Renamed to GDRestoreDeviceClut for consistentcy with
  28.             Apple's capitalization of RestoreDeviceClut.
  29. 2/22/93  dhb & dgp Converted for MATLAB
  30. */
  31.  
  32. #include "VideoToolbox.h"
  33. #include <Menus.h>
  34.  
  35. void RestoreCluts(void)
  36. {
  37.     // RestoreDeviceClut(NULL);    //  Apple's version, restore all cluts
  38.     GDRestoreDeviceClut(NULL);    // my version, restore all cluts
  39.     // Apple suggests making these two calls as well, to force redrawing of
  40.     // everything.
  41.     PaintBehind(NULL,GetGrayRgn());
  42.     DrawMenuBar();
  43. }